home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 76 / DVD Actual 1 Marzo 2003.iso / Trial / TurboCAD 7.1 Pro / Data.Cab / F25227_SDKDemoFrame.java < prev    next >
Encoding:
Java Source  |  2000-11-10  |  1.3 KB  |  52 lines

  1. import java.awt.*;
  2.  
  3. class SDKDemoFrame extends Frame
  4. {
  5.     public SDKDemoFrame(String str)
  6.     {
  7.         super (str);
  8.     }
  9.  
  10.     public boolean handleEvent(Event evt)
  11.     {
  12.         switch (evt.id)
  13.         {
  14.             case Event.WINDOW_DESTROY:
  15.                 dispose();
  16.                 System.exit(0);
  17.                 return true;
  18.             default:
  19.                 return super.handleEvent(evt);
  20.         }             
  21.     }
  22.     public void dispose()
  23.     {
  24.  
  25.         // Set all vars to null to make sure that the reference counts are decremented 
  26.         // to release server application
  27.         
  28.         if (parent.theDrawingCanvas.m_IDrawings != null)
  29.            parent.theDrawingCanvas.m_IDrawings.Close();  // close any open TC file
  30.  
  31.         // it is good practice to release the obtained interfaces in reverse or
  32.         // to how they were obtained, although for Java, that is up to the virual 
  33.         // machines garbage collection.
  34.            parent.theDrawingCanvas.m_ITheView = null;
  35.         parent.theDrawingCanvas.m_IViews = null;
  36.         parent.theDrawingCanvas.m_ITheDrawing = null;
  37.         parent.theDrawingCanvas.m_IDrawings = null;
  38.         parent.theDrawingCanvas.m_IApp = null;
  39.         
  40.         super.dispose();  // call the action that remove window and resources.
  41.  
  42.     }
  43.  
  44.     public void setParent(SDKDemo parent)
  45.     {   this.parent = parent;
  46.     }
  47.  
  48.  
  49.     SDKDemo parent;
  50.     DrawingCanvas theDrawingCanvas = null;
  51. }
  52.